package cheme.ProcessModel.Interpreter;

import cheme.ProcessModel.ProcessModel;
import cheme.ProcessModel.Equations.Equation;
import cheme.ProcessModel.Equations.EquationList;
import cheme.ProcessModel.Interpreter.IRuleCheckVisitor.RuleCheckVisitorStub;
import cheme.ProcessModel.ProcessUnits.Streams.Tags.OverallTagComponent;
import cheme.ProcessModel.ProcessUnits.Streams.Tags.Tag;
import cheme.ProcessModel.ProcessUnits.Streams.Tags.TagComponent;
import cheme.ProcessModel.ProcessUnits.Streams.Tags.TagComponentList;
import cheme.ProcessModel.Visitors.ReflectiveVisitor;

public class PreparseRuleChecker extends RuleCheckVisitorStub
{

	public Object visit(Tag modelElement)
	{
		add(PreParseRules.nonNull);
		add(PreParseRules.isModelElement);

		return ReflectiveVisitor.NullReturn;
	}
	
	public Object visit(TagComponentList modelElement)
	{
		add(PreParseRules.nonNull);
		add(PreParseRules.isModelElement);

		return ReflectiveVisitor.NullReturn;
	}
	
	public Object visit(OverallTagComponent modelElement)
	{
		add(PreParseRules.nonNull);
		add(PreParseRules.isModelElement);

		//Make sure that this is the last rule to run. See the definition for reasoning	 
		add(PreParseRules.tagComponentListensToRefs);

		return ReflectiveVisitor.NullReturn;
	}
	
	public Object visit(TagComponent modelElement)
	{
		add(PreParseRules.nonNull);
		add(PreParseRules.isModelElement);
		
		//Make sure that this is the last rule to run. See the definition for reasoning
		add(PreParseRules.tagComponentListensToRefs);

		return ReflectiveVisitor.NullReturn;
	}
	
	public Object visit(Equation modelElement)
	{
		add(PreParseRules.nonNull);
		add(PreParseRules.isModelElement);
			
		//Make sure that this is the last rule to run. See the definition for reasoning
		add(PreParseRules.equationListensToRefs);
		
		//		Make sure that this is the last rule to run. See the definition for reasoning
		add(PreParseRules.equationIndependenceListensToRefs);

		return ReflectiveVisitor.NullReturn;
	}
	

	public Object visit(EquationList modelElement)
	{
		add(PreParseRules.nonNull);
		add(PreParseRules.isModelElement);
		

		return ReflectiveVisitor.NullReturn;
	}
	
	public Object visit(ProcessModel modelElement)
	{
		//add(PreParseRules.degreesOfFreedomTest);//PA Commented

		return ReflectiveVisitor.NullReturn;
	}
}
